home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
80x0393.zip
/
VIDTYPE.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-03-30
|
37KB
|
1,111 lines
comment *
Author:
Yousuf J. Khan
Purpose:
To detect what type of video adapter is installed.
Note:
Work was based on source code inside Richard Wilton's
"Programmer's Guide to PC & PS/2 Video Systems" book. However
it's been heavily reworked to a more (dare I say?)
understandable format. Also Super VGA tests were put in,
something completely missing from Wilton's book.
*
.model tiny
;.stack 200h
.data
std0type db 0 ;first video subsystem type
ext0type db 0 ;extended info on first subsystem
std1type db 0 ;second video subsystem type
ext1type db 0 ;extended info on second subsystem
vidflag record monofound:1,colorfound:1
egatype vidflag <0,0> ;Was a mono or color EGA found?
;
;video adapter codes (based on codes returned by VGA BIOS DC codes):
;-these codes are used when a VGA BIOS is not found and other tests
; need to be performed to determine video type
;-it was decided to use the VGA BIOS DC codes for simplicity
;-see findVGA procedure for list of VGA DCCs.
;
NoDISP equ 0 ;no display
MONO equ 1
CGA equ 2
cEGA equ 4 ;color EGA
mEGA equ 5 ;mono EGA
.code
org 100h ;*.COM start offset
start:
call findVGA ;look for a VGA or MCGA
comment \
After executing VGA BIOS routines, the VGA BIOS itself will have
done all the work of determining what is installed so no need to
do any further tests. The "findVGA" subprocedure will set the CF
upon returning, if a VGA BIOS was found.
\
jc endtests ;found VGA/MCGA, end of tests
call findEGA ;look for an EGA
call findCGA ;look for a CGA
call findMono ;look for an MDA or HGC
endtests:
call write_msg ;write found info to screen, set
; errorlevel
mov ah, 4ch ;end program
int 21h
findVGA proc
comment *
Purpose:
determine if a MCGA/VGA/SVGA display is installed
Entry:
nothing
Return:
CF set if found, clear if not
*
mov ax, 1A00h ;get Displ Combo Code info
int 10h
cmp al, 1Ah ;VGA-only BIOS function
jne noVGA ; not supported => no VGA
comment \
Upon Return from Int 10h, AX=1A00h:
BL=primary adapter DCC
BH=secondary adapter DCC
Values for display combination code:
00h no display
01h monochrome adapter w/ monochrome display
02h CGA w/ color display
03h reserved
04h EGA w/ color display
05h EGA w/ monochrome display
06h PGA w/ color display
07h VGA w/ monochrome analog display
08h VGA w/ color analog display
09h reserved
0Ah MCGA w/ digital color display
0Bh MCGA w/ monochrome analog display
0Ch MCGA w/ color analog display
FFh unknown display type
\
push bx ;interpretDCC destroys contents of BH
call interpretDCC ;this proc looks for extended info
mov [std0type], bl ;save normal info
mov [ext0type], bh ;save extended info
pop bx
push bx
;Since proc interpretDCC only works on info in BL, we must
; exchange BL with BH.
xchg bh, bl
call interpretDCC
mov [std1type], bl ;save normal info
mov [ext1type], bh ;save extended info
pop bx
stc ;found VGA/MCGA, so set CF before ret
jmp endVGAtest
noVGA:
clc
endVGAtest:
ret
interpretDCC proc
comment *
Purpose:
Interprets information returned by the DCC
Upon Entry:
BL=normal DCC of desired video subsystem
BH=will be destroyed, replaced with ext code
Upon Return:
BL=normal DCC returned (MDA,CGA,EGA,PGA,MCGA,VGA,etc)
BH=extended code (HGC,SVGA), 0 if none
*
mov bh, 0 ;Assume no extended attribs
cmp bl, 0 ;If 0, then no display card
je end_interpret
cmp bl, 1 ;Mono
je monotests
jmp CGAtests
monotests:
;
;If we find a monochrome adapter, then we need to do special
; further tests to see if we have just an MDA or one of the
; Hercules cards.
;
mov bh, bl ;save normal DCC in BH
call findHGC ;MDA or HGC? value returned in
; BL
xchg bh, bl ;BL=normal,BH=extended
jmp end_interpret
CGAtests:
cmp bl, 2 ;CGA
je end_interpret
cmp bl, 6 ;EGA or PGA
jbe end_interpret
cmp bl, 8 ;BL=7,8: VGA
ja end_interpret
;
;If we find a VGA, then we need to do extra tests to see whose
; VGA chipset it is.
;
mov bh, bl ;save BL in BH
call findSVGA ;search for SVGA adapter
xchg bh, bl ;BH=extended, BL=normal
end_interpret:
ret
endp
endp
findSVGA proc
comment *
Purpose:
To search for specific SVGA types, including VESA compatibility.
Entry:
Nothing
Return:
BL=SVGA type
*
comment \
List of SVGA types:
Brand Type
----- ----
ATI 1─┐
Ahead 2 │ These chipsets all have
Paradise 3 │ easily identifiable BIOS based
Oak 4 │ identification methods.
Genoa 5─┘
Cirrus 6─┐
Chips&Tech 7 │ These chipsets require complicated
Tseng 8 │ register twiddlings to identify
ZyMos 9 │ their presense.
Trident 10─┘
8514/A 11 -checks for HDILOAD.EXE only
If a VESA BIOS is present, then add 128 to errorlevels.
Note: The BIOS based id strings were obtained from Ralf Brown's
PD DOS Interrupts list (INTER32).
The register level chipset tests were obtained through various
sources, including John Bridges' VGAKIT 5.0, and Andrew
Rossmann's INFOPLUS 1.55 source code. However, both gentlemen
appear to have gotten their info through the book "Advanced
Programmer's Guide to Super VGAs", by George Sutty and Steve
Blair. So lay credit wherever you like.
\
noSVGA equ 0
mov bl, noSVGA ;initially assume no SVGA
push es ;save current ES segment
mov ax, 0C000h ;set ES to VBIOS
mov es, ax ; segment (C000h)
;
;now testing for ATI chipset
;
.data
ATIid db "761295520"
idlen = $-ATIid
ATI equ 1
.code
mov di, 31h ;id string offset in ATI VBIOS
mov si, offset ATIid
mov cx, idlen
repe cmpsb ;comp each byte, exit if not matched
jne noATI
mov bl, ATI ;ATI was found
jmp endSVGAtests
noATI:
;
;now testing for Ahead chipset
;
.data
AHEADid db "AHE